﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TE_Student_Question.aspx.cs"
    Inherits="School.Pages.Teaching.TE_Student_Question" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            //click event
            $('.extentable .header').click(function (event) {
                event.preventDefault();
                var par = $(this);
                var removed = false;
                if (par.hasClass("ui-corner-all")) {
                    par.removeClass("ui-corner-all");
                    removed = true;
                }
                par.next().slideToggle('fast', function () {
                    par.toggleClass("ui-state-default").toggleClass("ui-state-active");
                    if (!removed)
                        par.addClass("ui-corner-all");
                });
            });
            // add extent, invese, collapse button
            $('.control .inverse').click(inverse);
            $('.control .collapse').click(collapse);
            $('.control .extend').click(extent);
        });
        function inverse() {
            $('.extentable .header').click();
        }
        function extent() {
            $('.extentable .header').each(function (event) {
                var par = $(this);
                if (par.hasClass("ui-corner-all")) {
                    par.removeClass("ui-corner-all");
                    par.next().slideToggle('fast', function () {
                        par.toggleClass("ui-state-default").toggleClass("ui-state-active");
                    });
                }

            });
        }
        function collapse() {
            $('.extentable .header').each(function (event) {
                var par = $(this);
                if (!par.hasClass("ui-corner-all")) {
                    par.next().slideToggle('fast', function () {
                        par.toggleClass("ui-state-default").toggleClass("ui-state-active");
                        par.addClass("ui-corner-all");
                    });
                }

            });
        }

    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div align="right">
        <asp:ListView ID="LstSchools" runat="server" DataKeyNames="ID,Question_Id,Id" 
            OnItemDataBound="LstSchools_ItemDataBound">
            <EmptyDataTemplate>
                <div class="empty">
                    لا يوجد عناصر متاحة
                </div>
            </EmptyDataTemplate>
            <ItemTemplate>
                <div class="ui-corner-all ui-corner-top ui-state-default header">
                    <span class="ui-icon-ext" style="float: right;"></span>
                    <div>
                        <div class="lbl">
                            الســــؤال :
                        </div>
                        <div class="data">
                            <%# Eval("Question")%>
                        </div>
                    </div>
                </div>
                <div class="ui-corner-bottom detail" style="display: none">
                    <div>
                        <div class="lbl">
                            الإجابات:
                        </div>
                        <div class="data">
                            <asp:RadioButtonList ID="rdbchoice" runat="server" DataSourceID="EdsrdbChoice" DataTextField="Choices"
                                DataValueField="Id" Visible='False'>
                            </asp:RadioButtonList>
                            <asp:CheckBoxList ID="Chchoice" runat="server" DataSourceID="EdsrdbChoice" DataTextField="Choices"
                                DataValueField="Id" Visible='False'>
                            </asp:CheckBoxList>
                            <asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal"
                                DataSourceID="EdsrdbChoice" DataTextField="Choices" DataValueField="Id" Visible='False'>
                                <%--      <asp:ListItem Value="1">صح</asp:ListItem>
                                <asp:ListItem Value="2">خطأ</asp:ListItem>--%>
                            </asp:RadioButtonList>
                            <asp:EntityDataSource ID="EdsrdbChoice" runat="server" ConnectionString="name=SchoolEntities"
                                DefaultContainerName="SchoolEntities" EnableFlattening="False" EntitySetName="TE_Question_Bank_answer"
                                EntityTypeFilter="" Select="it.[Id], it.[Question_Id], it.[Choices], it.[Choice_Type]"
                                AutoGenerateWhereClause="true">
                                <%--      AutoGenerateWhereClause="true" Where="">
                                <WhereParameters>
                                    <asp:ControlParameter ControlID="LstSchools" DefaultValue="" Name="Question_Id" PropertyName="DataKeys"
                                        Type="Int64" />
                                </WhereParameters>--%>
                            </asp:EntityDataSource>
                        </div>
                    </div>
                </div>
            </ItemTemplate>
            <LayoutTemplate>
                <div id="itemPlaceholderContainer" runat="server" class="default padding_right_left extentable">
                    <div runat="server" id="itemPlaceholder" />
                </div>
                <div class="lvpager">
                    <asp:DataPager ID="DataPager1" runat="server" PageSize="10">
                        <Fields>
                            <asp:NextPreviousPagerField ShowFirstPageButton="false" ShowNextPageButton="False"
                                PreviousPageText="السابق" ButtonType="Link" />
                            <asp:NumericPagerField ButtonType="Link" />
                            <asp:NextPreviousPagerField ShowLastPageButton="false" ShowPreviousPageButton="False"
                                NextPageText="التالى" ButtonType="Link" />
                        </Fields>
                    </asp:DataPager>
                </div>
            </LayoutTemplate>
        </asp:ListView>
        <asp:EntityDataSource ID="EdsTopic_Question" runat="server" ConnectionString="name=SchoolEntities"
            DefaultContainerName="SchoolEntities" EnableFlattening="False" EntitySetName="VTE_Topic_Question"
            Select="it.[Question_Id], it.[Topic_Id], it.[Question], it.[Id], it.[Degree]"
            Where="it.[Topic_Id]=@id" OrderBy="it.[Question]">
            <WhereParameters>
                <asp:QueryStringParameter Name="id" Type="Int64" DefaultValue="" QueryStringField="id" />
            </WhereParameters>
        </asp:EntityDataSource>
    </div>
    <div align="center">
        <asp:Button ID="btnsave" runat="server" Text="حفــظ" OnClick="btnsave_Click" />
    </div>
    </form>
</body>
</html>
